<?php
include("head.php");
$sql = "SELECT * FROM Article WHERE status>0 ORDER BY `id` DESC limit 6";
$result=mysqli_query($conn,$sql);
$arr = array();
while($row=mysqli_fetch_array($result, MYSQLI_NUM)){
    $arr[]=$row;
}
?>
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">

        <div class="container-fluid am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                    <div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 个人主页</div>
                    <p class="page-header-description">个人设置，密码修改，文章发布、修改、删除</p>
                </div>
            </div>

        </div>


            <div class="row am-cf">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-4 widget-margin-bottom-lg ">
                    <div class="tpl-user-card am-text-center widget-body-lg">
                        <div class="tpl-user-card-title">
                            <?php echo $_SESSION['username']?>
                        </div>
                        <div class="achievement-subheading">
                            最新发布文章
                        </div>
                        <img class="achievement-image" src="../admin/assets/img/user07.png" alt="">
                        <div class="achievement-description">

                            <strong>你可以</strong> 在这里
                            <strong>删除或修改</strong>你的文章。
                        </div>
                    </div>
                </div>

                <div class="am-u-sm-12 am-u-md-12 am-u-lg-8 widget-margin-bottom-lg">

                    <!--搜索功能-->
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                        <form method="post" action="select.php">
                        <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                            <input type="text" class="am-form-field" name="title" placeholder="输入文章标题">
                            <span class="am-input-group-btn">
                            <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search" type="submit" name="submit"></button>
                            </span>
                        </div>
                        </form>
                    </div

                    <div class="widget am-cf widget-body-lg">

                        <div class="widget-body  am-fr">
                            <div class="am-scrollable-horizontal ">
                                <table width="100%" class="am-table am-table-compact am-text-nowrap tpl-table-black " id="example-r">
                                    <thead>
                                    <tr>
                                        <th>id</th>
                                        <th>Title</th>
                                        <th>作者</th>
                                        <th>类型</th>
                                        <th>时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php foreach($arr as $data):?>
                                        <tr class="gradeX">
                                            <td><?php echo $data[0];?></td>
                                            <td><?php echo $data[4];?></td>
                                            <td><?php echo $data[2];?></td>
                                            <td><?php echo $data[3];?></td>
                                            <td><?php echo $data[5];?></td>
                                            <td>
                                                <div class="tpl-table-black-operation">
                                                    <a href="detail.php?id=<?php echo $data[0];?>">
                                                        <i class="am-icon-pencil"></i> 查看
                                                    </a>
                                                </div>
                                            </td>
                                        </tr>
                                    <?php endforeach;?>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
